from django.shortcuts import render

# Create your views here.
from django.http import HttpResponse
from django.utils import timezone

from .models import Question, Choice


def index(request):
    # Question.objects.filter()
    # q = Question(question_text="What's new?", pub_date=timezone.now())
    # q.save()
    # c = Choice(question=q, choice_text="What's new?choice_text", votes=0)
    # c.save()
    print("======================================")
    data = {}
    # data["Question"] = Question.objects.all().values_list("id")
    data["Choice"] = Choice.objects.using("master").values_list("id", "question_id", "choice_text", "votes")
    # data["Choice"] = Choice.objects.all().values_list("id")
    print(data)
    return HttpResponse(str(data))
